# -*- mode: python -*-
import SCons

Import("env")

env = env.Clone()

install_dir = env.Dir("$DESTDIR/$PREFIX_BINDIR").path.replace("\\", r"\\")
resmoke_py = env.Substfile(
    target="resmoke.py",
    source="resmoke.py.in",
    SUBST_DICT={
        "@install_dir@": install_dir,
    },
)
resmoke_py_install = env.AutoInstall(
    "$PREFIX_BINDIR",
    source=resmoke_py,
    AIB_COMPONENT="common",
    AIB_ROLE="runtime",
)
setattr(resmoke_py_install[0].attributes, "AIB_NO_ARCHIVE", True)
env.AddPostAction(
    resmoke_py_install,
    action=SCons.Defaults.Chmod("$TARGET", "u+x"),
)
